/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-03-27
 * Time: 14:15
 */
public class Demo7 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread1=new Thread(()->{
            for (int i = 0; i < 5; i++) {
                System.out.println("hello thread1"  );
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("1 end");
        });
        Thread thread2=new Thread(()->{
            for (int i = 0; i < 3; i++) {
                System.out.println("hello thread2"  );
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("2      end");
        });
        thread1.start();
        thread2.start();
        thread1.join();
        thread2.join();
        System.out.println("main end");

    }

}
